<?php 
require_once 'init.php';
require_once 'ckLogin.php';
require_once 'dbClasses'.DIRECTORY_SEPARATOR.'config.php';
require_once 'dbClasses'.DIRECTORY_SEPARATOR.'dbConn.php';
$db = new dbConn();
$db->DB_NAME="Pictures";
//提交处理
if(strtoupper($_SERVER['REQUEST_METHOD'])=='POST'){
	foreach ($_POST as $key=>$item){
		$idget = explode('_', $key);
		$db->sql="UPDATE Pictures SET Description = '".$item."' WHERE Identifier = ".$idget[1];
		$db->doExecute();
	}
?>
	<script type="text/javascript">
		this.location.replace('picList.php');
	</script>
<?php 	
}
//根据ids获取图片信息
$db->sql = "SELECT * FROM Pictures WHERE Identifier IN (".trim($_GET['ids'],',').")";
$pics = $db->doResultList2();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>Simpla Admin</title>

<!--                       CSS                       -->

<!-- Reset Stylesheet -->
<link rel="stylesheet" href="resources/css/reset.css" type="text/css"
	media="screen" />

<!-- Main Stylesheet -->
<link rel="stylesheet" href="resources/css/main.css" type="text/css"
	media="screen" />

<!-- Invalid Stylesheet. This makes stuff look pretty. Remove it if you want the CSS completely valid -->
<link rel="stylesheet" href="resources/css/invalid.css" type="text/css"
	media="screen" />

<!-- Colour Schemes
	  
		Default colour scheme is green. Uncomment prefered stylesheet to use it.
		
		<link rel="stylesheet" href="resources/css/blue.css" type="text/css" media="screen" />
		
		<link rel="stylesheet" href="resources/css/red.css" type="text/css" media="screen" />  
	 
		-->

<!-- Internet Explorer Fixes Stylesheet -->

<!--[if lte IE 7]>
			<link rel="stylesheet" href="resources/css/ie.css" type="text/css" media="screen" />
		<![endif]-->

<!--                       Javascripts                       -->

<!-- jQuery -->
<script type="text/javascript" src="resources/scripts/jquery-1.7.2.min.js"></script>
<script type="text/javascript">
$(function($) {
	$("#moreEdit").click(function(){
		var nullNum = 0;
		$(":text").each(function() {
			if(!$(this).val()){
				nullNum++;
			}
		});
		if(nullNum != 0){alert("还有"+nullNum+"个描述没有填写！");return false;}	
	});
});
</script>
<!-- jQuery Configuration -->
<script type="text/javascript"
	src="resources/scripts/simpla.jquery.configuration.js"></script>

<!-- Facebox jQuery Plugin -->
<script type="text/javascript" src="resources/scripts/facebox.js"></script>

<!-- jQuery WYSIWYG Plugin -->
<script type="text/javascript" src="resources/scripts/jquery.wysiwyg.js"></script>

<!-- jQuery Datepicker Plugin -->
<script type="text/javascript"
	src="resources/scripts/jquery.datePicker.js"></script>
<script type="text/javascript" src="resources/scripts/jquery.date.js"></script>
<!--[if IE]><script type="text/javascript" src="resources/scripts/jquery.bgiframe.js"></script><![endif]-->


<!-- Internet Explorer .png-fix -->

<!--[if IE 6]>
			<script type="text/javascript" src="resources/scripts/DD_belatedPNG_0.0.7a.js"></script>
			<script type="text/javascript">
				DD_belatedPNG.fix('.png_bg, img, li');
			</script>
		<![endif]-->

</head>

<body>
	<div id="body-wrapper">
		<!-- Wrapper for the radial gradient background -->
		
		<div id="main-content">
			<!-- Main Content Section with everything -->

			<!-- Page Head -->
			<h2>欢迎使用<?php echo APPLICATION;?>管理后台</h2>
			<p id="page-intro">接下来你要做什么呢亲？</p>
			<div class="clear"></div>
			<!-- End .clear -->

			<div class="content-box">
				<!-- Start Content Box -->

				<div class="content-box-header">

					<h3>Content box</h3>

					<div class="clear"></div>

				</div>
				<!-- End .content-box-header -->

				<div class="content-box-content">

					<div class="tab-content default-tab" id="tab2">

						<form action="#" method="post">

							<fieldset>
								<!-- Set class to "column-left" or "column-right" on fieldsets to divide the form into columns -->
								<?php foreach ($pics as $key=>$item):?>
								<p>
									<label>编号:<?php echo $item['Identifier'];?> <img src="<?php echo "../".$item['Address'];?>" width="50px" height="50px" /></label> 
									<small><?php echo $item['Description'];?></small>
									<input class="text-input large-input" type="text" id="pic_<?php echo $item['Identifier'];?>" name="pic_<?php echo $item['Identifier'];?>" />
								</p>
								<?php endforeach;?>
								<p>
									<input class="button" type="submit" value="修改" id="moreEdit"/>
								</p>

							</fieldset>

							<div class="clear"></div>
							<!-- End .clear -->

						</form>

					</div>
					<!-- End #tab2 -->

				</div>
				<!-- End .content-box-content -->

			</div>
			<!-- End .content-box -->
			<div class="clear"></div>
			<div id="footer">
				<small> <!-- Remove this notice or replace it with whatever you want -->
					&#169; Copyright 2009 Your Company | Powered by <a
					href="http://themeforest.net/item/simpla-admin-flexible-user-friendly-admin-skin/46073">Simpla
						Admin</a> | <a href="#">Top</a>
				</small>
			</div>
			<!-- End #footer -->

		</div>
		<!-- End #main-content -->

	</div>
</body>


<!-- Download From www.exet.tk-->
</html>
